package file;

import java.io.File;
import java.io.IOException;

public class File1 {

	public static void main(String[] args) throws IOException {
		File file = new File("D:" + File.separator);
		System.out.println(file.exists()+"判断是否存在");
		if(!file.exists()){
			file.createNewFile();
		}else{
			file.delete();
		}
		if (file.isFile()) {
			System.out.println("文件");
		} else if(file.isDirectory()){
			System.out.println("目录");
		}else{
			System.out.println("别的");
		}
	/*	String[] list=file.list();
		for (String string : list) {
			System.out.println(string);
		}*/
		System.out.println(File.pathSeparator);
		System.out.println(File.pathSeparatorChar);
		System.out.println(File.separator);
		System.out.println(File.separatorChar);
		System.out.println(File.listRoots());
		File file3=new File(file,File.separator+"goo");
		file3.mkdir();//创建目录
		File file4=new File(file,File.separator+"f1"+File.separator+"f2");
		file4.mkdir();//这个不行
		file4.mkdirs();
		File file2=new File(file,File.separator+"test.log");
		System.out.println(file2.getParent());
		System.out.println(file2.getName());
		System.out.println(file2.canExecute()+"  "+file2.canRead()+"  "+file2.canWrite()+"  "+file2.createNewFile()+"  ");
		System.out.println(file2.getPath());
	}

}
